package com.mm.cloud.lease.controller;

import com.mm.cloud.common.core.result.Result;
import com.mm.cloud.lease.dto.income.form.GenerateTenantIncomeDTO;
import com.mm.cloud.lease.service.ITenantIncomeService;
import com.mm.cloud.lease.vo.income.preview.TenantIncomePreviewVO;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 租客账单 前端控制器
 */
@RestController
@AllArgsConstructor
@RequestMapping("/tenant-income")
public class TenantIncomeController {

    private final ITenantIncomeService tenantIncomeService;

    /**
     * 预览账单接口
     * 根据租客信息中的租赁周期与缴费方式进行试算，不落库
     */
    @PostMapping("/preview")
    public Result<TenantIncomePreviewVO> preview(@RequestBody GenerateTenantIncomeDTO dto) {
        return tenantIncomeService.previewIncome(dto);
    }
}
